extends /templates/base

block content

  .form-horizontal
    form#espionage-form.form-group
      if !me.isAdmin()
        .col-sm-2
        .col-sm-4
        .col-sm-1
      else
        label.control-label.col-sm-2(for="espionage-name-or-email") Espionage
        .col-sm-4
          input.form-control#espionage-name-or-email(placeholder="Email, username or id", type="text")
        .col-sm-1
          button.btn.btn-primary.btn-large#enter-espionage-mode 007
      label.control-label.col-sm-5(for="espionage-name-or-email")
        em you are currently #{me.get('name') || '(no username)'} at #{me.get('email') || '(no email)'}
        if view.amActually
          br
          em but you are actually #{view.amActually.get('name') || '(no username)'} at #{view.amActually.get('email') || '(no email)'}
          br
          button#stop-spying-btn.btn.btn-xs Stop Spying
        if view.featureMode
          br
          em and you are viewing feature mode "#{view.featureMode}"
          =" "
          button#clear-feature-mode-btn.btn.btn-sm Clear Feature Mode
  if me.isAdmin() || me.isOnlineTeacher()
    .form-horizontal
      form#user-search-form.form-group
        label.control-label.col-sm-2(for="user-search") User Search
        .col-sm-4
          input.form-control#user-search(placeholder="Email, username, name, whatever", type="text")
          a.search-help-toggle(href="#") (search help)
          .search-help
            h4 Search Syntax
            ul
              li use <code>role:teacher</code> to limit a search by role
              li By default parts of the search are matched exactly.
              li <code>*</code> can be used as a wildcard character (ex. '<code>rob*@gmail.com</code>')
              li Avoid special charaters and puncuation.  Consider replacing them with <code>*</code> in searches.
              li
                a(href='http://sphinxsearch.com/docs/latest/extended-syntax.html') Complete Syntax Guide
        .col-sm-1
          button.btn.btn-primary.btn-large#user-search-button  Search
    #user-search-result

  if me.isOnlineTeacher() && !me.isAdmin()
    div.text-center Use the search box above to find and administer student accounts.
  else if me.isParentAdmin() && !me.isAdmin()
    p Set if admin is currently online / offline:
    div.btn-group.btn-group-toggle#toggle-admin-availability(data-toggle="buttons")
      label.btn.btn-secondary(data-value="on" class=`${parentAdminUpdateInProgress ? 'disabled' : ''} ${parentAdminAvailabilityStatus == 'on' ? 'active' : ''}`)
        input(type="radio" name="options" autocomplete="off" :)
        | Online
      label.btn.btn-secondary(data-value="off" class=`${parentAdminUpdateInProgress ? 'disabled' : ''} ${parentAdminAvailabilityStatus == 'off' ? 'active' : ''}`)
        input(type="radio" name="options" autocomplete="off")
        | Offline
      label.btn.btn-secondary(data-value="by-schedule" class=`${parentAdminUpdateInProgress ? 'disabled' : ''} ${parentAdminAvailabilityStatus == 'by-schedule' ? 'active' : ''}`)
        input(type="radio" name="options" autocomplete="off")
        | By Schedule
  else if !me.isAdmin()
    div.text-center You must be logged in as an admin to view this page.
  else
    h4 Entities
    ul
      li
        a(href="/admin/trial-requests") Trial Requests
      li
        a(href="/admin/user-code-problems") User Code Problems
      li
        a.edit-mandate(href="#mandate") Edit Mandate
      li
        a(href="/admin/trial-classes" id="view-trial-classes") View Trial Classes
      li
        a(href="javascript:void(0)" id="stop-trial-classes") Stop Trial Classes

    h4 Analytics
    ul
      li
        a(href="/admin/classrooms-progress?startDay=2019-08-01&endDay=2019-12-31") Classroom Progress vs. Available Content
      //- li
      //-   a(href="/admin/classroom-content") Amount of Classroom Content
      li
        a(href="/admin/classroom-levels") Classroom Levels
      li
        a(href="/admin/analytics") Dashboard
      li
        a(href="/admin/level-hints") Level Hints
      li
        a(href="/admin/school-licenses") School Active Licenses
      li
        a(href="/admin/school-counts?batchsize=20000") School Counts
      li
        a(href="/admin/analytics/subscriptions") Subscriptions
      li
        a(href="/admin/sub-cancellations") Subscription Cancellations
      li
        a(href="/admin/demo-requests") Teacher Demo Requests
      li
        a(href="/admin/low-usage-users") Low Usage Users
    p
      button.classroom-progress-csv.btn.btn-sm.btn-success Classroom Progress CSV
      input.classroom-progress-class-code(type=text placeholder="<class code>")

    h4 Other
    ul
      li
        a(href="/admin/outcomes-report") Old outcomes report (use new one in user modal)
      li
        a(href="/admin/base") Base (for debugging base.pug)
      li
        a(href="/admin/clas") CLAs
      li
        a(href="/admin/pending-patches") Patches
      li
        a(href="/admin/skipped-contacts") Sales — Contacts skipped by sales automation scripts
      li
        a(href="/admin/partial-unit-release") Partial Unit Release
      li
        a(href="javascript:void(0)" id="maintenance-mode") Maintenance mode
      li
        a(href="javascript:void(0)" id="teacher-license-code") Teacher license code


    hr
    h3 URL query parameters for *this page*
    p You can create special URLs for this page to do things automatically.
    p
      strong General format:
      - var s = "/admin?parameter1=value1" + "&" + "parameter2=value2" + "&" + "parameter3=value3"
      span.spl= s
    p
      strong search:
      span.spl automatically searches for the given user
      div
        a(href="/admin?search=matt") /admin?search=matt
    p
      strong spy:
      span.spl automatically spys on a given user
      div
        a(href="/admin?spy=matt@example.com") /admin?spy=matt@example.com
    p
      strong user:
      span.spl automatically open the user dialog for given user id
      div
        a(href="/admin?user=1234567890") /admin?user=1234567890

    hr
    h3 Prepaids
    a.btn.btn-secondary#create-free-sub-btn Create Free Subscription Link
    span.spl.spr
      if view.freeSubLink
        input#free-sub-input(type="text", readonly, value=view.freeSubLink)

    .form-inline
      .form-group
        label(for="users") Users
        input#users.form-control(name="users", type="number", min=1)
      .form-group
        label(for="months") Months
        input#months.form-control(name="months", type="number", min=1)
      .form-group
        label(for="endDate") Expiration Date
        input#endDate.form-control(type="date" name="endDate" value=view.prepaidEndDate)

      br
      a#terminal-create.btn.btn-default Create Terminal Subscription Code
      a#terminal-activation-create.btn.btn-default Create Terminal Subscription Activation Code


    hr

    h3 Achievements
    p This is just some stuff for temporary achievement testing. Should be replaced by a demo system.

    input#increment-field(type="text")
    a.btn.btn-secondary#increment-button(href="#") Increment

    hr

    .form-horizontal
      h3 PayPal Search
      form(action='/db/payments/-/all').form-group
        label.control-label.col-sm-2(for="paypal-input") PayPal Search
        .col-sm-4
          input.form-control#paypal-input(name="payPalResource", placeholder="PayPal Transaction ID")
          input(type="hidden", name="project", value="purchaser,recipient,created,service,amount,gems")
          input(type="hidden", name="limit", value="10")
        .col-sm-1
          button.btn.btn-primary(type="submit") Search
